package ctrLag;
import modelLag.*;

/**
 * Write a description of class LoanCtr here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class LoanCtr {
    // instance variables - replace the example below with your own
    private LoanContainer loanCon;
    
    /**
     * Constructor for objects of class LoanCtr
     */
    public LoanCtr() {
        // initialise instance variables
        loanCon = LoanContainer.getInstance();
    }

    public void addLoan(int serialNumber, String loanName, String loanDate, String returnDate) {
        Loan loan = new Loan(loanName, serialNumber, loanDate, returnDate);
        loanCon.addLoan(loan);
    }
    
    public Loan findLoan(int serialNumber) {
        Loan loan = loanCon.findLoan(serialNumber);
        return loan;
    }
    
    public void deleteLoan(int serialNumber) {
        int i = 0;
        loanCon.deleteLoan(serialNumber);
    }
    
    public void updateLoan(Loan loan, int newSerialNumber, String newLoanName, String newLoanDate, String newReturnDate) {
        loan.setSerialNumber(newSerialNumber);
        loan.setLoanName(newLoanName);
        loan.setLoanDate(newLoanDate);
        loan.setReturnDate(newReturnDate);
    }
    
    public void printLoanList() {
        loanCon.printLoanList();
    }
}
